<?php

class Persion {
    public $name = 'lisi';

    /**
     * 方法的定义
     * 和涵数的定义一致
     */
    function say(){
        echo ' My name is '.$this->name;
        print('<br>');
        #echo ' My age is '.$this->age;
        $this->sayMyAge();
    }
    function setAge($age=22){
        $this->age=$age;
    }
    public function sayMyAge(){
        echo ' My age is '.$this->age;
    }
}

$a = 12;
$b = $a;
echo 'a='.$a,'b='.$b,'<br>';
$p1 = new Persion();
$p2 = $p1;
echo 'p1->name=',$p1->name,'p2->name=',$p2->name,'<br>';
$p2->name='wangwu';
echo 'p1->name=',$p1->name,'p2->name=',$p2->name,'<br>';